#pragma once
#include <sstream>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
class TimeLen{
private:
	int day;
	int hour;
	int min;
	int sec;
public:
	/*
	TimeLen的构造函数
	*/
	TimeLen();
	TimeLen(time_t t);
	TimeLen(int d,int h,int m,int s);
	TimeLen(const char *s);
	TimeLen(const string &s);
	
	/*
	set functions for TimeLen
	*/
	void set(time_t t);
	void set(int d,int h,int m,int s);
	void set(const char *s);
	void set(const string &s);
	
	/*
	类型转换函数
	*/
	operator time_t()const;
	operator string()const;
	
	/*时长运算，
	注意，由于本类表示的时长皆是1s的整数倍，
	乘法是求时长的k倍
	故除法是换算成秒之后的整除*/
	TimeLen operator +(const TimeLen& b)const;
	TimeLen operator -(const TimeLen& b)const;
	TimeLen operator *(int k)const;
	TimeLen operator /(int k)const;
};
TimeLen operator *(int k,const TimeLen& a);
